package com.wlz.util;

import com.google.common.collect.Lists;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wlz
 * @date 2023-04-04  11:28
 */
public class ListPartitionTest {

    public static void main(String[] args) {
        List<String> vins = new ArrayList<>();
        for (int i = 0; i < 5000; i++) {
            vins.add(i+"");
        }
//        List<List<String>> partitionIdList = Lists.partition(vins, 1000);
//        System.out.println(partitionIdList);

        List<String> lists = new ArrayList<>();
        int i = vins.size() / 1000;
        for (int j = 0; j <= i; j++) {
            List<String> list = new ArrayList<>(1000);
            if (j == i) {
                list = vins.subList(j * 1000, vins.size());
            } else {
                list = vins.subList(j * 1000, 1000 * (j + 1));
            }
            lists.addAll(list);
        }
        System.out.println(lists);
    }
}
